package com.ccsc.auth.entity;


import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.util.List;

/**
 * 职位
 * Created by yyangs on 2017/2/10.
 */
public class Position {
    private Integer id;//职位id
    private Integer rdop_id;//部门职位id
    private String name;//职位名称
    private String description;//描述
    private Integer status;//职位状态
    private Position parentPosition;//上级职位
    private Department department;//该职位所属部门
    private List<Role> roleList;//该职位所拥有的角色

    public Integer getRdop_id() {
        return rdop_id;
    }

    public void setRdop_id(Integer rdop_id) {
        this.rdop_id = rdop_id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Position getParentPosition() {
        return parentPosition;
    }

    public void setParentPosition(Position parentPosition) {
        this.parentPosition = parentPosition;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public List<Role> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }


    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(this.id).append(this.department.getId()).toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Position)) {
            return false;
        }
        Position o = (Position) obj;
        return new EqualsBuilder().append(this.id, o.id).append(this.department.getId(),o.department.getId()).isEquals();
    }
}
